package com.ibuonline.b2b.entity;

import java.io.Serializable;
import java.io.UnsupportedEncodingException;

import org.apache.commons.lang.StringUtils;

public class CmsHotKeywords implements Serializable {

	private static final long serialVersionUID = 2677549475225791087L;

	//fields
	private java.lang.Integer id;
	private java.lang.String keyword;
	private java.lang.Integer displayOrder;

	//default constructor
	public CmsHotKeywords() {
	}

	//getter
	public java.lang.Integer getId() {
		return id;
	}
	public java.lang.String getKeyword() {
		return keyword;
	}
	public java.lang.Integer getDisplayOrder() {
		return displayOrder;
	}

	//setter
	public void setId(java.lang.Integer id) {
		this.id = id;
	}
	public void setKeyword(java.lang.String keyword) {
		this.keyword = keyword;
	}
	public void setDisplayOrder(java.lang.Integer displayOrder) {
		this.displayOrder = displayOrder;
	}

	//equals method
	public boolean equals(Object other) {
		if (this == other)
			return true;
		if (!(other instanceof CmsHotKeywords))
			return false;

		final CmsHotKeywords cmsHotKeywords = (CmsHotKeywords)other;
		if (!this.id.equals(cmsHotKeywords.getId()))
			return false;

		return true;
	}

	//hashCode method
	public int hashCode() {
		StringBuffer keys = new StringBuffer();
		keys.append(id).append(",");
		if (keys.length() > 0)
			keys.deleteCharAt(keys.length() - 1);
		return keys.toString().hashCode();
	}

	//toString method
	public String toString() {
		return new StringBuilder("CmsHotKeywords[")
			.append("id=").append(id).append(", ")
			.append("keyword=").append(keyword).append(", ")
			.append("displayOrder=").append(displayOrder).append("]").toString();
	}
	
	///#########
	public String getEncodeKeyword() {
		if(StringUtils.isNotBlank(keyword)) {
			try {
				return java.net.URLEncoder.encode(keyword,"GBK");
			} catch (UnsupportedEncodingException e) {
				e.printStackTrace();
			}
		}
		return "";
	}
}